package y23.Sep;

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Test20 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0;i < n;i++){
            arr[i] = in.nextInt();
        }
        int count = 1;
        int flag = 0;
        for(int i = 0;i < n - 1;i++ ){
            if(arr[i] < arr[i+1]){
                if(flag == 0){
                    flag = 1;
                }
                if(flag == -1){
                    flag = 0;
                    count++;
                }
            }
            if(arr[i] > arr[i+1]){
                if(flag == 0){
                    flag = -1;
                }
                if(flag == 1){
                    flag = 0;
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}